/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.trandio.dao;

import java.sql.SQLException;
import java.util.List;
import javax.naming.NamingException;
import org.trandio.hb.TbDestinosalida;
import org.trandio.util.HibernateUtil;
import org.hibernate.Query;
import org.hibernate.Session;


/**
 *
 * @author root
 */
public class DestinoSalidaDAO implements DestinoSalidaInterface {
    
    private Session sesion;
    
  @Override
    public List<TbDestinosalida> ConsultarDestinoSalida() throws SQLException, NamingException {

        sesion = HibernateUtil.getSessionFactory().openSession();

        Query q;

        q = sesion.createQuery("from TbDestinosalida");

        return q.list();


    }

    @Override
    public List<TbDestinosalida> ConsultarDestinoSalida(int idDestinoSalida) throws SQLException, NamingException {

        sesion = HibernateUtil.getSessionFactory().openSession();

        Query q;

        q = sesion.createQuery("from TbDestinosalida where id=?").setInteger(0, idDestinoSalida);

        return q.list();
    }
 
    
}
